1 /* 2 * The MIT License (MIT) 3 * 4 * Copyright (c) 2014 Devisualization (Richard Andrew Cattermole) 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights 9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 * copies of the Software, and to permit persons to whom the Software is 11 * furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in all 14 * copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 * SOFTWARE. 23 */ 24 module devisualization.util.opengl.function_wrappers.v12; 25 import gl = derelict.opengl3.gl; 26 import gldepcnst = derelict.opengl3.deprecatedConstants; 27 public import devisualization.util.opengl.function_wrappers.v10 : PixelFormat, BindTextureTarget, InternalFormat, PixelDataType; 28 public import devisualization.util.opengl.function_wrappers.v11 : Primitives; 29 30 enum BlendMode { 31 FuncAdd = gldepcnst.GL_FUNC_ADD, 32 FuncSubtract = gldepcnst.GL_FUNC_SUBTRACT, 33 FuncReverseSubtract = gldepcnst.GL_FUNC_REVERSE_SUBTRACT, 34 Min = gldepcnst.GL_MIN, 35 Max = gldepcnst.GL_MAX 36 } 37 38 enum TextureTargets { 39 Texture3D = gl.GL_TEXTURE_3D, 40 ProxyTexture3D = gl.GL_PROXY_TEXTURE_3D, 41 Texture2DArray = gl.GL_TEXTURE_2D_ARRAY, 42 ProxyTexture2DArray = gl.GL_PROXY_TEXTURE_2D_ARRAY 43 } 44 45 enum SubTextureTargets { 46 Texture3D = gl.GL_TEXTURE_3D, 47 Texture2DArray = gl.GL_TEXTURE_2D_ARRAY, 48 } 49 50 enum PixelSubTextureFormat { 51 Red = gl.GL_RED, 52 RG = gl.GL_RG, 53 RGB = gl.GL_RGB, 54 BGR = gl.GL_BGR, 55 RGBA = gl.GL_RGBA, 56 StencilIndex = gl.GL_STENCIL_INDEX, 57 DepthComponent = gl.GL_DEPTH_COMPONENT 58 } 59 60 void glBlendColor(ubyte r, ubyte g, ubyte b, ubyte a) { 61 gl.glBlendColor(r / 255f, g / 255f, b / 255f, a / 255f); 62 } 63 64 void glBlendEquation(BlendMode mode) { 65 gl.glBlendEquation(cast(gl.GLenum)mode); 66 } 67 68 void glDrawRangeElements(Primitives mode, gl.GLuint start, gl.GLuint end, ubyte[] data) { 69 gl.glDrawRangeElements(cast(gl.GLenum)mode, start, end, cast(uint)data.length, gl.GL_UNSIGNED_BYTE, data.ptr); 70 } 71 72 void glDrawRangeElements(Primitives mode, gl.GLuint start, gl.GLuint end, ushort[] data) { 73 gl.glDrawRangeElements(cast(gl.GLenum)mode, start, end, cast(uint)data.length, gl.GL_UNSIGNED_SHORT, data.ptr); 74 } 75 76 void glDrawRangeElements(Primitives mode, gl.GLuint start, gl.GLuint end, uint[] data) { 77 gl.glDrawRangeElements(cast(gl.GLenum)mode, start, end, cast(uint)data.length, gl.GL_UNSIGNED_INT, data.ptr); 78 } 79 80 void glTexImage3D(BindTextureTarget target, int level, InternalFormat internalFormat, int width, int height, int depth, PixelFormat format, PixelDataType type, void[] data) { 81 gl.glTexImage3D(cast(gl.GLenum)target, level, cast(gl.GLenum)internalFormat, width, height, depth, 0, cast(gl.GLenum)format, cast(gl.GLenum)type, data.ptr); 82 } 83 84 void glTexImage3D(TextureTargets target, int level, InternalFormat internalFormat, int width, int height, int depth, PixelFormat format, PixelDataType type, void[] data) { 85 gl.glTexImage3D(cast(gl.GLenum)target, level, cast(gl.GLenum)internalFormat, width, height, depth, 0, cast(gl.GLenum)format, cast(gl.GLenum)type, data.ptr); 86 } 87 88 void glTexSubImage3D(SubTextureTargets target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, PixelSubTextureFormat format, PixelDataType type, void[] data) { 89 gl.glTexSubImage3D(cast(gl.GLenum)target, level, xoffset, yoffset, zoffset, width, height, depth, cast(gl.GLenum)format, cast(gl.GLenum)type, data.ptr); 90 } 91 92 void glCopyTexSubImage3D(SubTextureTargets target, int level, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height) { 93 gl.glCopyTexSubImage3D(cast(gl.GLenum)target, level, xoffset, yoffset, zoffset, x, y, width, height); 94 }